<?php   if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta content="nofollow" name="robots">
		<link rel='stylesheet' type='text/css' media='all' href='<?php echo base_url() ?>files/cp/style.css' />
		<script type="text/javascript" src="<?php echo base_url() ?>files/javascripts/jquery/jquery.js"></script>
		<script type="text/javascript" src="<?php echo base_url() ?>files/javascripts/jquery/jquery-ui.js"></script>
		<script type="text/javascript" src="<?php echo base_url() ?>files/javascripts/jquery/jquery-cookie.js"></script>
		<script type="text/javascript">
		<!--
			var BASEURL = '<?php echo base_url(); ?>';
			var activeMenu = '<?php echo $moduleName ?>Menu';
		//-->
		</script>
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/header.js"></script>
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/one.js"></script>
		
		<?php if(isset($validation) && $validation): ?>
		<script type="text/javascript" src="<?php echo base_url() ?>files/javascripts/validator.js"></script>
		<script type="text/javascript">
		one.validatorExist = true;
		</script>
		<?php endif;
		if(isset($xinha) && $xinha):?>
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/xinha/XinhaConfig.js"></script>
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/xinha/XinhaCore.js"></script>
		<script type="text/javascript">
		var waitAndInit = function(){
			setTimeout(xinha_init,1000);
		};
		$(window).load(waitAndInit);
		one.xinhaExist = true;
		</script>
		<?php endif;
		if(isset($calendar) && $calendar):?>
		<link rel='stylesheet' type='text/css' media='all' href='<?php echo base_url() ?>files/cp/javascripts/calendar/skins/calendar-blue.css' />
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/calendar/jalali.js"></script>
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/calendar/calendar.js"></script>
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/calendar/lang/calendar-en.js"></script>
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/calendar/calendar-setup.js"></script>
		<script type="text/javascript">
		one.calendarExist = true;
		</script>
		<?php endif;
		if(isset($categoryScript) && $categoryScript): ?>
		<script type="text/javascript" src="<?php echo base_url() ?>files/cp/javascripts/categories.js"></script>
		<script type="text/javascript">
		one.catsScriptExist = true;
		</script>
		<?php endif;?>
		
		<link rel="shortcut icon" href="<?php echo base_url() ?>files/cp/icons/favicon.png">
		<title><?php echo $title ?></title>
	</head>
		
	<body style='background-image: url(<?php echo base_url()?>files/cp/icons/specific/bg.gif); background-repeat: no-repeat;background-position: top;'>
		<table width="100%">
			<tr>
				<td colspan="2">
					<div id="headerContainer" style="display: none;">
						<table border="0" cellpadding="0" cellspacing="0"><tr>
							<td nowrap="nowrap"><img border="0" src='<?php echo base_url() ?>files/cp/icons/specific/header.gif'></td>
							<td width="90%"></td>
							<td nowrap="nowrap">
								<div id="userInfo" style="margin-right:15px;">
									<table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td width="95%"><hr noshade="noshade"></td>
											<td><a title="<?php echo $this->lang->line("exit"); ?>" href='<?php echo base_url()?>cp/users/logout'><img title="<?php echo $this->lang->line("exit"); ?>" alt="<?php echo $this->lang->line("exit"); ?>" align="top" border="0" src='<?php echo base_url() ?>files/cp/icons/power.gif'></a></td>
											<td width="5%"><hr noshade="noshade"></td>
										</tr>
									</table>
									<ul style='padding: 0px;margin: 0px; list-style: none;'>
										<li><?php echo $this->lang->line("welcome"); ?><a href="<?php echo base_url(); ?>cp/home/form/CPUsersModel/<?php echo $this->session->userdata("userid")?>" onclick="one.changeContent(this.href); return false;"><?php echo $this->session->userdata("userfullname")?></a>.</li>
										<?php $time = time() - $this->session->userdata('logintime'); ?>
										<li><?php echo $this->lang->line("active-time"); ?><?php if(intval($time/86400) > 0):$days = intval($time / 86400); echo $days; echo($days > 1)?" days & ":" day & "; ?><?php else: $days = 0; endif;?><span id="timeContainer"><?php $hours = intval($time/(60*60)); echo (strlen($hours-$days*24) > 1)?$hours-$days*24:"0".($hours-$days*24); ?>:<?php $minutes = intval($time/60) - ($hours*60); echo (strlen($minutes) >1)?$minutes:"0".$minutes; ?>:<?php $seconds = intval($time%60); echo (strlen($seconds) > 1)?$seconds:"0".$seconds; ?></span></li>
									</ul>
								</div>
							</td>
							<td width="2%"></td>
							</table>
					</div>
				</td>
			</tr>
			
			<tr><td colspan="2"><hr noshade="noshade"></td></tr>
			<tr>
				<td nowrap="nowrap" valign="top">
					<ul class="menu" id="menu" style="background-image: url(<?php echo base_url() ?>files/cp/icons/menu-bg.gif)">
						<?php if(count($articlesModuleAL) > 0 && ($articlesModuleAL[0]->perm_view || $articlesModuleAL[0]->perm_add)): ?>
						<li>
							<span style="cursor: pointer;" onclick='$("#articlesMenu").toggle("slow");'><b>Articles</b></span>
							<ul id="articlesMenu" style='display: none;'>
								<?php if($articlesModuleAL[0]->perm_add): ?>
									<li><a href='<?php echo base_url()?>cp/home/form/articlesModel' onclick="one.changeContent(this.href); return false;">Add article</a></li>
								<?php endif; ?>
								<?php if($articlesModuleAL[0]->perm_view): ?>
								<li><a href='<?php echo base_url()?>cp/home/inventory/articlesModel' onclick="one.changeContent(this.href); return false;">Articles list</a></li>
								<?php endif; ?>
							</ul>
						</li>
						<br>
						<?php endif; ?>
						<?php /* if(count($contactsModuleAL) > 0 && ($contactsModuleAL[0]->perm_view)): ?>
						<li>
							<span style="cursor: pointer;" onclick='$("#contactsMenu").toggle("slow");'><b>Contacts</b></span>
							<ul id="contactsMenu" style='display: none;'>
								<li><a href='<?php echo base_url()?>cp/contacts/inventory/contactsModel' onclick="one.changeContent(this.href); return false;">Contacts list</a></li>
							</ul>
						</li>
						<br>
						<?php endif; */ ?>
						<?php if(count($productsModuleAL) > 0 && ($productsModuleAL[0]->perm_view || $productsModuleAL[0]->perm_add)): ?>
						<li>
							<span style="cursor: pointer;" onclick='$("#productsMenu").toggle("slow");'><b>Products</b></span>
							<ul id="productsMenu" style='display: none;'>
								<?php if($productsModuleAL[0]->perm_add): ?>
									<li><a href='<?php echo base_url()?>cp/home/form/productsModel' onclick="one.changeContent(this.href); return false;">Add product</a></li>
								<?php endif; ?>
								<?php if($productsModuleAL[0]->perm_view): ?>
									<li><a href='<?php echo base_url()?>cp/home/inventory/productsModel' onclick="one.changeContent(this.href); return false;">Products list</a></li>
									<li><a href='<?php echo base_url()?>cp/categories/getCatsHTML/productsModel' onclick="one.changeContent(this.href); return false;">Products categories</a></li>
								<?php endif; ?>
							</ul>
						</li>
						<br>
						<?php endif; ?>
						<?php if(count($pagesModuleAL) > 0 && ($pagesModuleAL[0]->perm_view || $pagesModuleAL[0]->perm_add)): ?>
						<li>
							<span style="cursor: pointer;" onclick='$("#pagesMenu").toggle("slow");'><b>Static pages</b></span>
							<ul id="pagesMenu" style='display: none;'>
								<?php if($pagesModuleAL[0]->perm_add): ?>
									<li><a href='<?php echo base_url()?>cp/home/form/pagesModel' onclick="one.changeContent(this.href); return false;">Add page</a></li>
								<?php endif; ?>
								<?php if($pagesModuleAL[0]->perm_view): ?>
									<li><a href='<?php echo base_url()?>cp/home/inventory/pagesModel' onclick="one.changeContent(this.href); return false;">Pages list</a></li>
									<li><a href='<?php echo base_url()?>cp/categories/getCatsHTML/pagesModel' onclick="one.changeContent(this.href); return false;">Pages categories</a></li>
								<?php endif; ?>
							</ul>
						</li>
						<br>
						<?php endif; ?>
						<?php if(count($cpusersModuleAL) > 0 && ($cpusersModuleAL[0]->perm_view || $cpusersModuleAL[0]->perm_add)): ?>
						<li>
							<span style="cursor: pointer;" onclick='$("#cpusersMenu").toggle("slow");'><b>Control panel users</b></span>
							<ul id="cpusersMenu" style='display: none;'>
								<?php if($cpusersModuleAL[0]->perm_add): ?>
									<li><a href='<?php echo base_url()?>cp/home/form/CPUsersModel' onclick="one.changeContent(this.href); return false;">Add user</a></li>
								<?php endif; ?>
								<?php if($cpusersModuleAL[0]->perm_view): ?>
									<li><a href='<?php echo base_url()?>cp/home/inventory/CPUsersModel' onclick="one.changeContent(this.href); return false;">Users list</a></li>
								<?php endif; ?>
								<?php if($cpusersModuleAL[0]->perm_view): ?>
									<li><a href='<?php echo base_url()?>cp/categories/getCatsHTML/CPUsersModel' onclick="one.changeContent(this.href); return false;">Users categories</a></li>
								<?php endif; ?>
								<?php if($cpusersModuleAL[0]->perm_add): ?>
									<li><a href='<?php echo base_url()?>cp/home/form/accessLevelModel' onclick="one.changeContent(this.href); return false;">Add access level</a></li>
								<?php endif; ?>
								<?php if($cpusersModuleAL[0]->perm_view): ?>
									<li><a href='<?php echo base_url()?>cp/home/inventory/accessLevelModel' onclick="one.changeContent(this.href); return false;">Access levels list</a></li>
								<?php endif; ?>
							</ul>
						</li>
						<?php endif; ?>
					</ul>
				</td>
				<td width="100%" valign="top">
					<table cellpadding="0" cellspacing="0" border="0">
						<tr>
							<td nowrap="nowrap" height="18">
								<?php echo $this->lang->line("breadcrumb"); ?><span id="breadCrumb"><?php $i=0;foreach($breadcrumb as $bread=>$crumb): ?>
								<?php if(++$i > 1) echo "&raquo;";?>
								<?php if($crumb != ""):?>
								<a id="breadcrumb<?php echo $i;?>" href="<?php echo $crumb ?>" onclick="one.changeContent(this.href); return false;">
								<?php endif;?>
								<?php echo $bread ?>
								<?php if($crumb != ""):?>
								</a>
								<?php endif;?>
								<?php endforeach; ?></span>
							</td>
							<td width="100%"></td>
							<td nowrap="nowrap" height="21">
								<div id="loadingContainer">
									<table cellpadding="0" cellspacing="0" border="0" width="100%">
										<tr>
											<td align="center"><?php echo $this->lang->line("loading"); ?> <span id="loadingTimer" style='font-size: 8px;'>0</span><span style='font-size: 8px;'> Seconds</span></td>
										</tr>
									</table>
								</div>
							</td>
						</tr>
					</table>
					<br>
					<div id="content" style="background: url(<?php echo base_url() ?>files/cp/icons/home.gif) no-repeat right bottom;">
						<div id="core">
							<?php echo $content ?>
						</div>
					</div>
				</td>
			</tr>
			<tr><td colspan="2" style="text-align: center;direction: ltr;">
				<div style="margin-top:25px;"><?php echo $this->lang->line("cpFooter"); ?></div>
				<!-- div style="font-size: 9px;margin-top:5px;">Powered by <a style="font-size: 9px;" target="_balnk" href="http://www.yekcomputer.com/">YekComputer</a></div -->
			</td></tr>
		</table>
	</body>

</html>